<?php

namespace JsonRpc;

/**
 * Json Rpc panel for debugbar
 *
 * @author frosty
 */
class JsonRpcPanel extends \Nette\Object implements \Nette\Diagnostics\IBarPanel {

	/**
	 * Data of list methods
	 * @var array
	 */
	private $data;
	
	/**
	 * Set list of methods
	 * @param array $methods 
	 */
	public function __construct($methods)
	{
		$this->data = $methods;
	}

	/**
	 * Return tab
	 * @return string
	 */
	public function getTab()
	{
		return '<span title="RpcServer Panel">
				<img src="" />
				RpcServer
				</span>';
	}

	/**
	 * Return panel
	 * @return string
	 */
	public function getPanel()
	{ 
		$tpl = new \Nette\Templating\FileTemplate(__DIR__ . "/list-method.latte");
		$tpl->registerFilter(new \Nette\Latte\Engine);
		$tpl->methods = $this->data; 
		ob_start();
		$tpl->render();
		$content = ob_get_contents();
		ob_end_clean();
		return $content;
	}
	
	
}

